#define DEBUG
#include <cstdio>
#define MAXN 100000

using namespace std;

int main() {
#ifdef DEBUG
  freopen("2.in", "r", stdin);
  freopen("2.out", "w", stdout);
#endif

  static char s[MAXN+1];
  static int link[MAXN+2][26];
  int n, m;
  scanf("%d %d", &n, &m);
  scanf("%s", s);
  for (int i=n; i>0; i--) {
    for (int j=0; j<26; j++) {
      link[i][j] = link[i+1][j];
    }
    link[i][s[i-1]-'a']=i;
  }

  for (int i=1; i<=n; i++) {
    int a, b, c, d;
    scanf("%d %d %d %d", &a, &b, &c, &d);

    int ans=0;
    for (int i=link[a][s[c-1]-'a'], j=c; i<=b && j<=d; j++, ans++, i=link[i+1][s[j-1]-'a']);
    printf("%d\n", ans);
  }

  fclose(stdin);
  fclose(stdout);
  return 0;
}
